package com.yaowk.sfp.slideshow.server.controller;

import com.yaowk.sfp.common.base.PageReq;
import com.yaowk.sfp.common.base.PageResp;
import com.yaowk.sfp.slideshow.api.SlideshowApi;
import com.yaowk.sfp.slideshow.api.model.Slideshow;
import com.yaowk.sfp.slideshow.server.service.ISlideshowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 小凯
 **/
@RestController
@Api(tags = "轮播图")
public class SlideshowController implements SlideshowApi {

    @Autowired
    private ISlideshowService slideshowService;

    @Override
    @ApiOperation("查询轮播图列表")
    public PageResp<Slideshow> findAll(Slideshow slideshow, PageReq pageReq) {
        return slideshowService.findAll(slideshow, pageReq);
    }

    @Override
    @ApiOperation("查询轮播图详情")
    public Slideshow findOne(@PathVariable Long id) {
        return slideshowService.findById(id);
    }

    @Override
    @ApiOperation("保存轮播图")
    public Slideshow save(Slideshow slideshow) {
        return slideshowService.save(slideshow);
    }

    @Override
    @ApiOperation("删除轮播图")
    public void delete(@PathVariable Long id) {
        slideshowService.deleteById(id);
    }
}
